#ifndef INK_MODULE_I_H_INCLUDED
#define INK_MODULE_I_H_INCLUDED

#include "ink_foundation.h"

namespace ink
{

class module_i
{
public:
    virtual const string_t& name() = 0;
    virtual const uint32_t id() = 0;

    virtual bool init() = 0;
    virtual bool clean() = 0;

    virtual void set_id(uint32_t id) = 0;
};

template <typename interface_t>
class module_t : public module_i
               , public interface_t
{
public:
    virtual const string_t& name() {
        return name_;
    }

    virtual const uint32_t id() {
        return id_;
    }

    virtual bool init() {
        return false;
    }

    virtual bool clean() {
        return false;
    } 

    virtual void set_id(uint32_t id) {
        id_ = id;
    }
private:
    uint32_t id_;
    string_t name_;
};

class module_creator {
public:
    virtual module_i* create() = 0;
};

template <typename module_t>
class module_creator_t : public module_creator
{
public:
    virtual module_i* create() {
        return new module_t;
    } 
};


} // namespace ink

#endif // INK_MODULE_H_INCLUDED